using System;
using System.Collections.Generic;
using Clandestine.Engines.Field;

namespace Shlick.LayerModel
{
	// No longer used! To be removed, someday when it's uselessness is confirmed.
	internal class ObjectListItem : Item
	{
		public ObjectList List { get; private set; }
		
		private ObjectListItem(ObjectList item, MapDocument mapDocument, LayerTreeMode mode) : base(item, mapDocument, mode)
		{
			this.List = item;
		}
		
		public static ObjectListItem Get(ObjectList item, MapDocument mapDocument, LayerTreeMode mode)
		{
			if (cachedItems.ContainsKey(mode) && cachedItems[mode].ContainsKey(item))
				return (ObjectListItem)cachedItems[mode][item];
			else
				return new ObjectListItem(item, mapDocument, mode);
		} 
		
		public override int Row()
		{
			return 0;
		}
		
		public override Item Child(int row)
		{
			return null;
		}
		
		public override Item Parent()
		{
			return LevelItem.Get(this.List.Level, this.MapDocument, this.Mode);
		}
		
		public override int ChildrenCount()
		{
			return 0;
		}
		
		public override string GetData()
		{
			 return "Objects";
		}
		
		public override string GetName()
		{
			return string.Empty;
		}
		
		public override bool? IsVisible()
		{
			 return this.List.Visible;
		}
		
		public override bool SetVisible(bool visible)
		{
			this.List.Visible = visible;
			return true;
		}
	}
}